<?php
        $yearArr = $this->ClassGrade();
        $text = new Default_Model_SystemText();
        $textOptions = $text->getKindArray('stud_kind');

$this->headLink()
->appendStylesheet($this->Css('table.css'));
$this->headScript()->appendFile($this->js('jquery-ui/ui/jquery.ui.draggable.js'))
->appendFile($this->js('jquery-ui/ui/jquery.ui.resizable.js'))
->appendFile($this->js('plugins/jquery.tablesorter.js'))
->appendFile($this->js('jquery-ui/ui/jquery.ui.dialog.js'));
?>
<script>
$(document).ready(function(){
    $("#dialog").dialog({
        bgiframe: true,
        autoOpen: false,
        width:800,
        height: 500,
        modal: true
    });
    $("#data-area a").click(function(){
    	var id = $(this).attr('id');
    	$.get('<?php echo $this->route("get-detail")?>',
    			{id:id},
    			function(data) {
    			    $("#sel-content").html(data);
    			    $("#csvUrl").attr('href','<?php echo $this->route("get-detail")?>?type=csv&id='+id);
    			    $("#dialog").dialog('open');
    			});
    });
});
</script>

<style>
.newspaper-a {font-size:100%;margin: 5px auto; white-space: nowrap; text-align:center; width:98%}
.newspaper-a caption {font-size:15px}
</style>

<table border="1" class="newspaper-a"  id="data-area">
<thead>
<tr>
    <th rowspan="2"><?php echo $this->translate('student character')?></th>
    <?php foreach($yearArr as $val):?>
    <th colspan="2"><?php echo $val?></th>
    <?php endforeach;?>
</tr>
<tr>
  <?php foreach($yearArr as $val):?>
    <th><?php echo $this->translate('boy')?></th>
    <th><?php echo $this->translate('girl')?></th>
<?php endforeach;?>
</tr>
</thead>
<tbody>
<?php foreach ($textOptions as $id=>$kindName):?>
<tr>
<td align="right"> <span><?php echo $kindName?></span>
<?php if ($id>0):?>
 <a href="#"  class="showDetail" id="<?php echo $id?>-all"><img src="<?php echo $this->baseUrl?>/images/zoom-in" border="0"></a>
 <?php endif?>
</td>
  <?php foreach($yearArr as $grade=>$val):?>
    <td><?php echo isset($this->data[$id][$grade]['M']) ? $this->data[$id][$grade]['M'] : ''?></td>
    <td><?php echo isset($this->data[$id][$grade]['F'])? $this->data[$id][$grade]['F']: ''?></td>
<?php endforeach;?>
</tr>
<?php endforeach?>
</tbody>
</table>

<div id="dialog" title="<?php echo $this->translate('students list')?>">
<span>
<a  id="csvUrl" class="fg-button ui-state-default ui-priority-primary ui-corner-all" style="margin:auto 5px"><?php echo $this->translate('export to csv file')?></a>
</span>

<div id="sel-content" style="clear:both"></div>
</div>